﻿namespace Web.Control.WWW.Teach
{
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;
    using System.IO;
    using Lx.Web.Common.ControlsUI;
    using Lx.Web.Common.UI;
    using BLF;
    using System.Collections.Generic;

    public class TCategories : BaseControl
    {
        protected string TL = "";
        protected Repeater rptUser;
        protected Repeater rptNewUser;
        protected Repeater rptLL;
        protected Repeater rptOthLan;
        protected override void OnLoad(EventArgs e)
        {
            if (Request.Cookies["italkiLearn"] != null)
                TL = Request.Cookies["italkiLearn"].Value == "all" ? "" : Request.Cookies["italkiLearn"].Value;
            ArrayList arrList = BLF.WWW_User.Teach.Teach.GetCategoriesTeacher(TL);
            if (arrList != null)
            {
                if (rptUser != null)
                {
                    rptUser.DataSource = arrList[0];
                    rptUser.DataBind();
                }
                if (rptNewUser != null)
                {
                    rptNewUser.DataSource = arrList[1];
                    rptNewUser.DataBind();
                }
            }

            if (rptLL != null)
            {
                List<LanguageObj> lanObjList = new List<LanguageObj>();
                lanObjList.AddRange(BLF.StaticData.GetPopLanguageList);
                rptLL.DataSource = lanObjList;
                rptLL.DataBind();
            }
            if (rptOthLan != null)
            {
                List<LanguageObj> lanObjList = new List<LanguageObj>();               
                lanObjList.AddRange(StaticData.GetLanguageObjList);
                for (; ; )
                {
                    if (lanObjList[0].LanguageValue.Trim() == "")
                    {
                        lanObjList.RemoveAt(0);
                        break;
                    }
                    else
                    {
                        lanObjList.RemoveAt(0);
                    }
                }                
                rptOthLan.DataSource = lanObjList;
                rptOthLan.DataBind();
            }
        }
       
    }
}


